home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
webtp55.zip
/
TANGLE.CHG
< prev
next >
Wrap
Text File
|
1989-12-05
|
63KB
|
1,879 lines
% This is TANGLE.CHG for TURBO Pascal 5.5
%
% (c) 1989 by Peter Sawatzki <FE617@DHAFEU11.BITNET>
% Buchenhof 3, D-5800 Hagen 1 (Dahl), Germany (West)
%
% Change History:
%
% Initials: PS = Peter Sawatzki, FE617@DHAFEU11
% ========= WGS = Wayne G. Sullivan, WSULIVAN@IRLEARN
% PB = Peter Breitenlohner, PEB@DM0MPI11
%
% rel. date Author description
% ==== ==== ====== ===========
% v0.1 2-Mar-88 PS initial TP3 release
% v0.2 5-May-88 PS array-like macros: "()" solution
% v0.3 22-Aug-88 PS copy some Inlines from WGS
% v0.4 3-Sep-88 PS better handling of shl and shr
% v0.5 8-Dec-88 PS better array-like macros based on PB's solution
% v0.6 10-Dec-88 PS TurboPascal-like hex constants
% v0.7 3-Jun-89 PS include the mod/and, div/shr optimization
% v0.8 29-Jul-89 PS @i option: (nested) include files
% v0.9 1-Aug-89 PS multiple change files
% v1.0 3-Aug-89 PS Inline assembler implemented
% v1.1 5-Dec-89 PS kill error in multiple change file handling
%
% Tangle/Compile Instructions:
% ============================
% TANGLE TANGLE /d /m /c
% TPC /$A+,O-,E-,N-,B-,I-,V-,S-,D- /$M$5000,0,$2000 TANGLE /M
%
%
% kludge fillchar firstvar -> lastvar inserted
%
────────────────────────────────────────────────────────────────
@x l.22 m.0
\def\PASCAL{Pascal}
@y
\def\PASCAL{Pascal}
\def\TP{\hbox{Turbo Pascal 5.5}}
@z
────────────────────────────────────────────────────────────────
@x l.36 m.0
\vfill}
@y
\centerline{(Changes for \TP, 5-Dec-89)}
\vfill}
@z
────────────────────────────────────────────────────────────────
@x l.64 m.1
@d banner=='This is TANGLE, Version 4'
@y
@d banner=='This is TANGLE, Version 4/TP55 1.1'
@z
────────────────────────────────────────────────────────────────
@x l.75 m.2
@d end_of_TANGLE = 9999 {go here to wrap it up}
@y
@z
────────────────────────────────────────────────────────────────
@x l.77 m.2
@p @t\4@>@<Compiler directives@>@/
program TANGLE(@!web_file,@!change_file,@!Pascal_file,@!pool);
label end_of_TANGLE; {go here to finish}
const @<Constants in the outer block@>@/
type @<Types in the outer block@>@/
var @<Globals in the outer block@>@/
@y
@p program TANGLE;
uses
Asm2Inl;
const @<Constants in the outer block@>@/
type @<Types in the outer block@>@/
const @<Typed constants in the outer block@>@/
var @/
firstvar: byte; @/
@<Globals in the outer block@>@/
lastvar: byte; @/
@<Inline procedures and functions@>@/
@<All purpose procedures and functions@>@/
@z
────────────────────────────────────────────────────────────────
@x l.94 m.3
@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
@y
@d ifdef(#)==@={$ifdef @>#@=}@>
@d endif==@={$endif}@>
@d debug==ifdef(deb)
@d gubed==endif
@d Asm(#)==inline(@[#@])
@z
────────────────────────────────────────────────────────────────
@x l.99 m.3
@d stat==@{ {change this to `$\\{stat}\equiv\null$'
when gathering usage statistics}
@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$'
when gathering usage statistics}
@y
@d stat==ifdef(sta)
@d tats==endif
@z
────────────────────────────────────────────────────────────────
@x l.114 m.4
@<Compiler directives@>=
@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
@y
@<Inline proc...@>=
function mavail: word;
Asm(mov ah,$48/ {allocate memory}
mov bx,$FFFF/ {determine free memory}
int $21/
mov ax,bx); {return size of largest available block}
function malloc (no: word): word;
Asm(mov ah,$48/ {allocate memory}
pop bx/ {no of bytes}
int $21/
jnc ok/ {no error}
xor ax,ax/ {clear ax in case of error}
ok: );
procedure mfree (segm: word);
Asm(mov ah,$49/ {free memory}
pop es/ {segment to free}
int $21);
@z
────────────────────────────────────────────────────────────────
@x l.139 m.6
@d incr(#) == #:=#+1 {increase a variable by unity}
@d decr(#) == #:=#-1 {decrease a variable by unity}
@d loop == @+ while true do@+ {repeat over and over until a |goto| happens}
@d do_nothing == {empty statement}
@d return == goto exit {terminate a procedure call}
@f return == nil
@f loop == xclause
@y
@d incr(#) == Inc(#) {increase a variable by unity}
@d decr(#) == Dec(#) {decrease a variable by unity}
@d loop == @+ while true do@+ {repeat over and over until a |goto| happens}
@d do_nothing == {empty statement}
@d return == @= exit @>
@f return == nil
@f loop == xclause
@d void == begin end
@z
────────────────────────────────────────────────────────────────
@x l.168 m.7
@d othercases == others: {default for cases not listed explicitly}
@y
@d othercases == else {default for cases not listed explicitly}
@z
────────────────────────────────────────────────────────────────
@x l.177 m.8
@!buf_size=100; {maximum length of input line}
@!max_bytes=45000; {|1/ww| times the number of bytes in identifiers,
strings, and module names; must be less than 65536}
@!max_toks=50000; {|1/zz| times the number of bytes in compressed \PASCAL\ code;
must be less than 65536}
@!max_names=4000; {number of identifiers, strings, module names;
must be less than 10240}
@y
@!buf_size=256; {maximum length of input line (must be |>255| for inline code)}
@!max_max_bytes=8000;
@!min_bytes=1000;
@!step_bytes=1000;
@!max_bytes: word = max_max_bytes;
{|1/ww| times the number of bytes in identifiers,
strings, and module names; must be less than 65536}
@!max_max_toks = 15000;
@!min_toks = 2000;
@!step_toks = 2000;
@!max_toks: word = max_max_toks;
{|1/zz| times the number of bytes in compressed \PASCAL\ code;
must be less than 65536}
@!max_names=4600; {number of identifiers, strings, module names;
must be less than 10240}
@z
────────────────────────────────────────────────────────────────
@x l.190 m.8
@!max_id_length=12; {long identifiers are chopped to this length, which must
not exceed |line_length|}
@!unambig_length=7; {identifiers must be unique if chopped to this length}
{note that 7 is more strict than \PASCAL's 8, but this can be varied}
@y
@!max_id_length=30; {long identifiers are chopped to this length, which must
not exceed |line_length|}
@!unambig_length=25; {identifiers must be unique if chopped to this length}
@z
────────────────────────────────────────────────────────────────
@x l.301 m.12
@!text_file=packed file of text_char;
@y
@!text_file=Text;
@ @d term_out==Output
@z
────────────────────────────────────────────────────────────────
@x l.303 m.13
@ The \.{WEAVE} and \.{TANGLE} processors convert between ASCII code and
the user's external character set by means of arrays |xord| and |xchr|
that are analogous to \PASCAL's |ord| and |chr| functions.
@<Globals...@>=
@!xord: array [text_char] of ASCII_code;
{specifies conversion of input characters}
@!xchr: array [ASCII_code] of text_char;
{specifies conversion of output characters}
@ If we assume that every system using \.{WEB} is able to read and write the
visible characters of standard ASCII (although not necessarily using the
ASCII codes to represent them), the following assignment statements initialize
most of the |xchr| array properly, without needing any system-dependent
changes. For example, the statement \.{xchr[@@\'101]:=\'A\'} that appears
in the present \.{WEB} file might be encoded in, say, {\mc EBCDIC} code
on the external medium on which it resides, but \.{TANGLE} will convert from
this external code to ASCII and back again. Therefore the assignment
statement \.{XCHR[65]:=\'A\'} will appear in the corresponding \PASCAL\ file,
and \PASCAL\ will compile this statement so that |xchr[65]| receives the
character \.A in the external (|char|) code. Note that it would be quite
incorrect to say \.{xchr[@@\'101]:="A"}, because |"A"| is a constant of
type |integer|, not |char|, and because we have $|"A"|=65$ regardle